package Objects;

import com.InfinityRun.Assets;
import com.InfinityRun.GameScene;
import com.InfinityRun.MainGame;
import com.graphics.Animation;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.Log;

public class Player extends GameObject
{
	Bitmap image;
	String move = "stop";
	
	public Player(int w, int h, Bitmap img)
	{
		super(MainGame.getWidth(), MainGame.getHeight() * 1.7f , w, h);
		image = Assets.player;
	}

	@Override
	public void Update(float deltaTime) 
	{
		super.Update(deltaTime);
		if(move == "right")
		{
			this.position.x += 150 * deltaTime;
		}
		
		if(move == "left")
		{
			this.position.x -= 150 * deltaTime;
		}
	}

	@Override
	public void Draw(Canvas c) 
	{
		c.drawBitmap(image, this.bounds.lowerLeft.x, this.bounds.lowerLeft.y ,null);
	}
		
	public boolean Collision(Obstacle b)
	{
		if(this.bounds.lowerLeft.x + this.bounds.width > b.bounds.lowerLeft.x &&
			this.bounds.lowerLeft.x < b.bounds.lowerLeft.x + b.bounds.width &&
			this.bounds.lowerLeft.y + this.bounds.height > b.bounds.lowerLeft.y &&
			this.bounds.lowerLeft.y <  b.bounds.lowerLeft.y + b.bounds.height)
		{
			return true;
		}
		
		return false;
	}
	
	public void move(String direction)
	{
		move = direction;
	}
	
	public void stopMove()
	{
		move = "stop";
	}
	
}
